/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package perso;

import carte.Carte;
import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.ImageIcon;

/**
 *
 * @author Administrateur
 */
public abstract class PersonnageTruand extends Personnage {

    public PersonnageTruand(int id, Carte carte) {
        super(id, carte);
    }

    @Override
    public void createPerso(ArrayList<Personnage> listPerso, int endPosX, int endPosY) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public boolean endOfGame(ArrayList<Personnage> listPerso) {
        int nbrTruand = 0;
        int nbrAgent = 0;

        Iterator<Personnage> itr = listPerso.iterator();
        while (itr.hasNext()) {

            Personnage perso = itr.next();
            if (perso instanceof Agent) {
                nbrAgent++;
            }
            if (perso instanceof Truand) {
                if (!((Truand) perso).isTaupe) {
                    nbrTruand++;
                }
            }
        }
        if (nbrAgent == 0) {
            return true;
        }
        if (nbrTruand == 0) {
            return true;
        }
        return false;
    }
}
